package com.itheima.health.config;

import com.itheima.health.utils.QiniuUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QiniuConfiguration {

    @ConfigurationProperties("qiniu")
    /**
     *  @Bean
     *     new出来的对象 交给spring管理了！！
     *        数据 是初始值  null
     *   @ConfigurationProperties("qiniu")
     *      qiniu:
     *   urlPrefix: http://rnu29zcbb.hn-bkt.clouddn.com/
     *   accessKey: wlJgmMyx5LAxtxTxpV1Pc9L_AxSJASkptC0jp6yB
     *   secretKey: HPbrS2wBsAwurCqnkRZCmPLiKRW5JWOv1Y9SKqKR
     *   bucket: spt-itheima-health
     *
     *     new出来对象之后
     *       底层通过反射调用set方法
     *          qiniuUtils.setUrlPrefix("http://rnu29zcbb.hn-bkt.clouddn.com/")
     */
    @Bean
    public QiniuUtils qiniuUtils() {
        return new QiniuUtils();
    }

}